home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Add-Ons / MPW / MPW noweb 2.7 / src / c / columns.nw < prev    next >
LaTeX Document  |  1995-05-30  |  1.6 KB  |  [TEXT/MPS ]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: LaTeX Document (document/latex).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert LaTeX Document (document/latex) magic Supported
1% dexvert NWiper Show (other/nWiperShow) ext Unsupported
1% dexvert Text File (text/txt) fallback Supported
100% file ASCII text, with CR line terminators default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/281 LaTeX (Subdocument) default
100% detectItEasy Format: plain text[CR] default (weak)


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[MPS ]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 25 20 43 6f 70 79 72 69 | 67 68 74 20 31 39 39 31 |% Copyri|ght 1991|
|00000010| 20 62 79 20 4e 6f 72 6d | 61 6e 20 52 61 6d 73 65 | by Norm|an Ramse|
|00000020| 79 2e 20 20 41 6c 6c 20 | 72 69 67 68 74 73 20 72 |y. All |rights r|
|00000030| 65 73 65 72 76 65 64 2e | 0d 25 20 53 65 65 20 66 |eserved.|.% See f|
|00000040| 69 6c 65 20 43 4f 50 59 | 52 49 47 48 54 20 66 6f |ile COPY|RIGHT fo|
|00000050| 72 20 6d 6f 72 65 20 69 | 6e 66 6f 72 6d 61 74 69 |r more i|nformati|
|00000060| 6f 6e 2e 0d 5c 73 75 62 | 73 65 63 74 69 6f 6e 7b |on..\sub|section{|
|00000070| 4d 61 6e 61 67 69 6e 67 | 20 69 6e 64 65 6e 74 61 |Managing| indenta|
|00000080| 74 69 6f 6e 20 61 6e 64 | 20 63 6f 6c 75 6d 6e 73 |tion and| columns|
|00000090| 7d 0d 54 68 65 73 65 20 | 66 75 6e 63 74 69 6f 6e |}.These |function|
|000000a0| 73 20 61 72 65 20 75 73 | 65 64 20 74 6f 20 68 65 |s are us|ed to he|
|000000b0| 6c 70 20 61 63 63 75 6d | 75 6c 61 74 65 20 69 6e |lp accum|ulate in|
|000000c0| 64 65 6e 74 61 74 69 6f | 6e 73 20 61 63 72 6f 73 |dentatio|ns acros|
|000000d0| 73 20 6d 6f 64 75 6c 65 | 0d 62 6f 75 6e 64 61 72 |s module|.boundar|
|000000e0| 69 65 73 20 62 79 20 6d | 65 61 73 75 72 69 6e 67 |ies by m|easuring|
|000000f0| 20 74 68 65 20 77 69 64 | 74 68 73 20 6f 66 20 76 | the wid|ths of v|
|00000100| 61 72 69 6f 75 73 20 73 | 74 72 69 6e 67 73 0d 69 |arious s|trings.i|
|00000110| 6e 20 63 6f 6c 75 6d 6e | 73 2e 20 20 0d 54 68 65 |n column|s. .The|
|00000120| 20 73 69 7a 65 20 6f 66 | 20 74 68 69 6e 67 73 20 | size of| things |
|00000130| 64 65 70 65 6e 64 73 20 | 6f 6e 20 5b 5b 74 61 62 |depends |on [[tab|
|00000140| 73 69 7a 65 5d 5d 20 61 | 73 20 64 65 66 69 6e 65 |size]] a|s define|
|00000150| 64 20 69 6e 20 63 6f 6c | 75 6d 6e 73 2e 68 2e 0d |d in col|umns.h..|
|00000160| 49 66 20 5b 5b 74 61 62 | 73 69 7a 65 20 3d 3d 20 |If [[tab|size == |
|00000170| 30 5d 5d 2c 20 74 61 62 | 73 20 73 68 6f 75 6c 64 |0]], tab|s should|
|00000180| 6e 27 74 20 62 65 20 74 | 6f 75 63 68 65 64 20 6f |n't be t|ouched o|
|00000190| 6e 20 69 6e 70 75 74 20 | 61 6e 64 20 77 6f 6e 27 |n input |and won'|
|000001a0| 74 20 62 65 20 0d 67 65 | 6e 65 72 61 74 65 64 20 |t be .ge|nerated |
|000001b0| 6f 6e 20 6f 75 74 70 75 | 74 2e 0d 3c 3c 68 65 61 |on outpu|t..<<hea|
|000001c0| 64 65 72 3e 3e 3d 0d 65 | 78 74 65 72 6e 20 69 6e |der>>=.e|xtern in|
|000001d0| 74 20 74 61 62 73 69 7a | 65 3b 0d 65 78 74 65 72 |t tabsiz|e;.exter|
|000001e0| 6e 20 69 6e 74 20 63 6f | 6c 75 6d 6e 77 69 64 74 |n int co|lumnwidt|
|000001f0| 68 20 28 63 68 61 72 20 | 2a 73 29 3b 20 20 20 20 |h (char |*s); |
|00000200| 20 20 2f 2a 20 6e 75 6d | 62 65 72 20 6f 66 20 63 | /* num|ber of c|
|00000210| 6f 6c 75 6d 6e 73 20 73 | 74 72 69 6e 67 20 6f 63 |olumns s|tring oc|
|00000220| 63 75 70 69 65 73 20 2a | 2f 0d 65 78 74 65 72 6e |cupies *|/.extern|
|00000230| 20 69 6e 74 20 6c 69 6d | 69 74 63 6f 6c 75 6d 6e | int lim|itcolumn|
|00000240| 20 28 63 68 61 72 20 2a | 73 2c 20 69 6e 74 20 73 | (char *|s, int s|
|00000250| 74 61 72 74 63 6f 6c 75 | 6d 6e 29 3b 0d 09 09 09 |tartcolu|mn);....|
|00000260| 09 2f 2a 20 77 69 64 74 | 68 20 6f 66 20 73 74 61 |./* widt|h of sta|
|00000270| 72 74 63 6f 6c 75 6d 6e | 20 62 6c 61 6e 6b 73 20 |rtcolumn| blanks |
|00000280| 70 6c 75 73 20 73 20 2a | 2f 0d 65 78 74 65 72 6e |plus s *|/.extern|
|00000290| 20 76 6f 69 64 20 69 6e | 64 65 6e 74 5f 66 6f 72 | void in|dent_for|
|000002a0| 20 28 69 6e 74 20 77 69 | 64 74 68 2c 20 46 49 4c | (int wi|dth, FIL|
|000002b0| 45 20 2a 66 70 29 3b 0d | 20 20 20 20 20 20 20 20 |E *fp);.| |
|000002c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000002d0| 20 20 20 20 20 20 20 20 | 2f 2a 20 69 6e 64 65 6e | |/* inden|
|000002e0| 74 20 74 6f 20 77 69 64 | 74 68 3b 20 6e 65 78 74 |t to wid|th; next|
|000002f0| 20 63 68 61 72 20 2d 3e | 20 77 69 64 74 68 2b 31 | char ->| width+1|
|00000300| 20 2a 2f 0d 40 20 25 64 | 65 66 20 74 61 62 73 69 | */.@ %d|ef tabsi|
|00000310| 7a 65 20 0d 3c 3c 2a 3e | 3e 3d 0d 23 69 6e 63 6c |ze .<<*>|>=.#incl|
|00000320| 75 64 65 20 3c 73 74 64 | 69 6f 2e 68 3e 0d 23 69 |ude <std|io.h>.#i|
|00000330| 6e 63 6c 75 64 65 20 22 | 63 6f 6c 75 6d 6e 73 2e |nclude "|columns.|
|00000340| 68 22 0d 0d 69 6e 74 20 | 74 61 62 73 69 7a 65 20 |h"..int |tabsize |
|00000350| 3d 20 38 3b 0d 3c 3c 2a | 3e 3e 3d 0d 69 6e 74 20 |= 8;.<<*|>>=.int |
|00000360| 63 6f 6c 75 6d 6e 77 69 | 64 74 68 20 28 63 68 61 |columnwi|dth (cha|
|00000370| 72 20 2a 73 29 20 7b 20 | 20 20 20 20 20 20 20 20 |r *s) { | |
|00000380| 20 20 20 20 2f 2a 20 77 | 69 64 74 68 20 6f 66 20 | /* w|idth of |
|00000390| 61 20 73 74 72 69 6e 67 | 20 69 6e 20 63 6f 6c 75 |a string| in colu|
|000003a0| 6d 6e 73 20 2a 2f 0d 20 | 20 72 65 74 75 72 6e 20 |mns */. | return |
|000003b0| 6c 69 6d 69 74 63 6f 6c | 75 6d 6e 28 73 2c 20 30 |limitcol|umn(s, 0|
|000003c0| 29 3b 0d 7d 0d 40 20 25 | 64 65 66 20 63 6f 6c 75 |);.}.@ %|def colu|
|000003d0| 6d 6e 77 69 64 74 68 0d | 3c 3c 2a 3e 3e 3d 0d 69 |mnwidth.|<<*>>=.i|
|000003e0| 6e 74 20 6c 69 6d 69 74 | 63 6f 6c 75 6d 6e 20 28 |nt limit|column (|
|000003f0| 63 68 61 72 20 2a 73 2c | 20 69 6e 74 20 63 6f 6c |char *s,| int col|
|00000400| 29 20 7b 0d 20 20 20 20 | 77 68 69 6c 65 20 28 2a |) {. |while (*|
|00000410| 73 29 20 7b 0d 20 20 20 | 20 20 20 20 20 63 6f 6c |s) {. | col|
|00000420| 2b 2b 3b 0d 20 20 20 20 | 20 20 20 20 69 66 20 28 |++;. | if (|
|00000430| 2a 73 3d 3d 27 5c 74 27 | 20 26 26 20 74 61 62 73 |*s=='\t'| && tabs|
|00000440| 69 7a 65 20 3e 20 30 29 | 20 77 68 69 6c 65 20 28 |ize > 0)| while (|
|00000450| 63 6f 6c 20 25 20 74 61 | 62 73 69 7a 65 20 21 3d |col % ta|bsize !=|
|00000460| 20 30 29 20 63 6f 6c 2b | 2b 3b 0d 20 20 20 20 20 | 0) col+|+;. |
|00000470| 20 20 20 73 2b 2b 3b 0d | 20 20 20 20 7d 0d 20 20 | s++;.| }. |
|00000480| 20 20 72 65 74 75 72 6e | 20 63 6f 6c 3b 0d 7d 0d | return| col;.}.|
|00000490| 40 20 25 64 65 66 20 6c | 69 6d 69 74 63 6f 6c 75 |@ %def l|imitcolu|
|000004a0| 6d 6e 0d 3c 3c 2a 3e 3e | 3d 0d 76 6f 69 64 20 69 |mn.<<*>>|=.void i|
|000004b0| 6e 64 65 6e 74 5f 66 6f | 72 20 28 69 6e 74 20 77 |ndent_fo|r (int w|
|000004c0| 69 64 74 68 2c 20 46 49 | 4c 45 20 2a 66 70 29 20 |idth, FI|LE *fp) |
|000004d0| 7b 20 0d 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |{ . | |
|000004e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000004f0| 20 20 20 2f 2a 20 77 72 | 69 74 65 20 77 68 69 74 | /* wr|ite whit|
|00000500| 65 73 70 61 63 65 20 5b | 5b 77 69 64 74 68 5d 5d |espace [|[width]]|
|00000510| 20 63 6f 6c 75 6d 6e 73 | 20 77 69 64 65 20 2a 2f | columns| wide */|
|00000520| 0d 2f 2a 66 70 72 69 6e | 74 66 28 66 70 2c 22 3c |./*fprin|tf(fp,"<|
|00000530| 25 32 64 3e 22 2c 77 69 | 64 74 68 29 3b 20 69 66 |%2d>",wi|dth); if|
|00000540| 20 28 77 69 64 74 68 3e | 34 29 20 7b 66 70 72 69 | (width>|4) {fpri|
|00000550| 6e 74 66 28 66 70 2c 22 | 20 20 20 20 22 29 3b 20 |ntf(fp,"| "); |
|00000560| 77 69 64 74 68 20 2d 3d | 20 34 3b 7d 2a 2f 0d 20 |width -=| 4;}*/. |
|00000570| 20 20 20 69 66 20 28 74 | 61 62 73 69 7a 65 20 3e | if (t|absize >|
|00000580| 20 31 29 0d 20 20 20 20 | 20 20 20 20 77 68 69 6c | 1). | whil|
|00000590| 65 20 28 77 69 64 74 68 | 20 3e 3d 20 74 61 62 73 |e (width| >= tabs|
|000005a0| 69 7a 65 29 20 7b 0d 20 | 20 20 20 20 20 20 20 20 |ize) {. | |
|000005b0| 20 20 20 70 75 74 63 28 | 27 5c 74 27 2c 20 66 70 | putc(|'\t', fp|
|000005c0| 29 3b 0d 20 20 20 20 20 | 20 20 20 20 20 20 20 77 |);. | w|
|000005d0| 69 64 74 68 20 2d 3d 20 | 74 61 62 73 69 7a 65 3b |idth -= |tabsize;|
|000005e0| 0d 20 20 20 20 20 20 20 | 20 7d 0d 20 20 20 20 77 |. | }. w|
|000005f0| 68 69 6c 65 20 28 77 69 | 64 74 68 20 3e 20 30 29 |hile (wi|dth > 0)|
|00000600| 20 7b 0d 20 20 20 20 20 | 20 20 20 70 75 74 63 28 | {. | putc(|
|00000610| 27 20 27 2c 20 66 70 29 | 3b 0d 20 20 20 20 20 20 |' ', fp)|;. |
|00000620| 20 20 77 69 64 74 68 2d | 2d 3b 0d 20 20 20 20 7d | width-|-;. }|
|00000630| 0d 7d 0d 40 20 25 64 65 | 66 20 69 6e 64 65 6e 74 |.}.@ %de|f indent|
|00000640| 5f 66 6f 72 0d | |_for. | |
+--------+-------------------------+-------------------------+--------+--------+